package zack.project.infrastructure.adapter.port;

import zack.project.domain.activity.adapter.port.IActivityPort;
import zack.project.infrastructure.gateway.LotteryRpcService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author A1793
 */
@Service
@Slf4j
public class ActivityPort implements IActivityPort {

    @Resource
    private LotteryRpcService lotteryRpcService;

    @Override
    public String getRandomAward(Integer takeCount, Long strategyId) {
          try{
              log.info("开始调用营销抽奖,获取随即折扣 takeCount:{},strategyId:{} ", takeCount, strategyId);
              return  lotteryRpcService.lottery(takeCount, strategyId);
          }catch (Exception e){
              log.error("错误信息:{}",e.getMessage());
          }
          return "1";
    }
}
